package easycloud.ecs.provider.aliyun.model;

import java.util.Date;
import java.util.TimeZone;

import org.apache.commons.lang.builder.ToStringBuilder;

import com.aliyun.openservices.oss.model.OSSObjectSummary;

import easycloud.ecs.api.model.IStorageObjectSummary;

public class AliyunStorageObjectSummary implements IStorageObjectSummary {

	private OSSObjectSummary objectSummary;

	public AliyunStorageObjectSummary(OSSObjectSummary objectSummary) {
		this.objectSummary = objectSummary;
	}

	@Override
	public String getETag() {
		return objectSummary.getETag();
	}

	@Override
	public String getKey() {
		return objectSummary.getKey();
	}

	@Override
	public Date getLastModified() {
		return new Date(objectSummary.getLastModified().getTime()
				+ TimeZone.getDefault().getOffset(
						objectSummary.getLastModified().getTime()));
	}

	@Override
	public long getSize() {
		return objectSummary.getSize();
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
